<script setup>
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'

// this.$store.state.count => store
const store = useStore()

const router = useRouter()
//
const count = computed(() => {
  store.state.count
})
const addOne = () => {
  store.commit('addOne')
}
const addOneAsync = () => {
  store.dispatch('addOneAsync')
}
</script>

<template>
  <div>登录组件 - {{ store.state.count }} - {{ store.getters.double }}</div>
  <button @click="router.push('/Home')">去首页</button>
  <button @click="addOne">+1</button>
  <button @click="addOneAsync">一秒后+1</button>
</template>
